# Maintainer: Rasmus Thomsen <oss@cogitri.dev>
pkgname=libpwquality
pkgver=1.4.2
pkgrel=1
pkgdesc="Password quality checking library"
url="https://github.com/libpwquality/libpwquality"
arch="all"
license="BSD-3-Clause"
makedepends="cracklib-dev python3-dev linux-pam-dev"
options="!check" # no tests
subpackages="$pkgname-static $pkgname-dev $pkgname-doc py3-$pkgname:_py3 $pkgname-lang"
source="https://github.com/libpwquality/libpwquality/releases/download/libpwquality-$pkgver/libpwquality-$pkgver.tar.bz2"

build() {
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--localstatedir=/var \
		--enable-python-bindings \
		--with-python-binary=python3 \
		--enable-pam \
		--with-securedir=/lib/security
	make
}

package() {
	make DESTDIR="$pkgdir" install
}

_py3() {
	pkgdesc="$pkgdesc - Python3 bindings"
	depends="$pkgname=$pkgver-r$pkgrel python3"

	mkdir -p "$subpkgdir"/usr/lib/
	mv "$pkgdir"/usr/lib/python* "$subpkgdir"/usr/lib/
}

sha512sums="6f395e94797cc565edae6de8f4c7c60736d07ffa849c9878ec4d867f8cb7bea6f08bdd20501791dd05b02d487f8fea66a02a30841c7cea6e86b5903eaf685879  libpwquality-1.4.2.tar.bz2"
